<template>
    <div>
    <ul class="products">
            <li v-for="item in tableData" :key="item.id" @click="handleDetail(item.id)">
                <img :src="item.image[0]" alt="">
                <p>{{ item.description }}</p>
                <div>
                    <span>￥{{ item.price }}</span>
                    <span>已售：{{ item.sold_count }}</span>
                </div>
            </li>
        </ul>
    </div>
</template>
<script>
export default {
    props:["tableData"],
   data() {
      return {
      }
   },
   created(){
   },
   computed:{
   },
   methods:{
    handleDetail(id){
        this.$router.push({path:"/product",query:{id:id,page:1}})
    }
   },
}
</script>
<style scoped>
     .products{
        width: 90%;
        display: flex;
        flex-flow: row wrap;
        justify-content: flex-start;
        align-items: center;
        margin: 0 auto;
    }
    .products li{
        width: 45%;
        height: 240px;
        margin-right: 10px;
    }
    .products li img{
        width: 100%;
        height: 165px;
    }
    .products li p{
        overflow: hidden;
        white-space: nowrap;
        text-overflow: ellipsis;
        font-size: 16px;
    }
    .products li div{
        display: flex;
        justify-content: space-between;
        align-items: center;
        margin-top: 5px;
    }
    .products li div span:first-child{
        font-size: 16px;
        color: #FA436A;
    }
    .products li div span:last-child{
        font-size: 12px;
        color: #909399;
    }
</style>
